/*
 * PayResultActivity.java
 * business
 *
 * Created by ChenTao on 2017/2/21.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.main.shoppingcart.orderresult;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.model.ConfirmOrderModel;
import com.yidiandao.business.utils.ActivityUtils;

public class OrderResultActivity extends BaseActivity {

    private OrderResultFragment mOrderResultFragment;

    public static void actionStart(Activity activity, String orderPayId, String orderId) {
        Intent intent = new Intent(activity, OrderResultActivity.class);
        intent.putExtra(Intents.EXTRA_ORDER_PAY_ID, orderPayId);
        intent.putExtra(Intents.EXTRA_ORDER_ID, orderId);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mOrderResultFragment = (OrderResultFragment) getSupportFragmentManager().findFragmentById(R.id.container_order_result);

        if (mOrderResultFragment == null) {
            mOrderResultFragment = OrderResultFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mOrderResultFragment, R.id.container_order_result);
        }
    }

    @Override
    protected void initPresenter() {
        new OrderResultPresenter(mOrderResultFragment, new ConfirmOrderModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_order_result;
    }
}
